class User {
  int? id;
  String username;
  String password;
  String? nickname;
  String? avatar;
  String? birthday;
  String? signature;
  String? city;

  User({
    this.id,
    required this.username,
    required this.password,
    this.nickname,
    this.avatar,
    this.birthday,
    this.signature,
    this.city,
  });

  Map<String, dynamic> toMap() {
    return {
      'id': id,
      'username': username,
      'password': password,
      'nickname': nickname,
      'avatar': avatar,
      'birthday': birthday,
      'signature': signature,
      'city': city,
    };
  }

  factory User.fromMap(Map<String, dynamic> map) {
    return User(
      id: map['id'],
      username: map['username'],
      password: map['password'],
      nickname: map['nickname'],
      avatar: map['avatar'],
      birthday: map['birthday'],
      signature: map['signature'],
      city: map['city'],
    );
  }

  User copyWith({
    int? id,
    String? username,
    String? password,
    String? nickname,
    String? avatar,
    String? birthday,
    String? signature,
    String? city,
  }) {
    return User(
      id: id ?? this.id,
      username: username ?? this.username,
      password: password ?? this.password,
      nickname: nickname ?? this.nickname,
      avatar: avatar ?? this.avatar,
      birthday: birthday ?? this.birthday,
      signature: signature ?? this.signature,
      city: city ?? this.city,
    );
  }
} 